<?php

namespace app\result;

class UploadFilesLogResult extends BaseResult
{
    //计算文件大小，返回mb、kb、gb
    static function format_size($size): string
    {
        $units = array('B', 'KB', 'MB', 'GB', 'TB');
        for ($i = 0; $size >= 1024 && $i < 4; $i++) $size /= 1024;
        return round($size, 2) . $units[$i];
    }
}
